package com.lightboat.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 订单状态
 *
 * @author lightboat
 */
@Getter
@AllArgsConstructor
public enum CrmOrderStatus {

    PENDING_PAYMENT(110, "待付款"),
    PENDING_SHIPMENT(140, "待发货"),
    SHIPPED(150, "待收货"),
    COMPLETED(200, "已完成"),
    SIGNED(190, "已签收"),
    CANCELED(130, "交易关闭"),
    AFTER_SALES(160, "售后中");

    private final Integer code;
    private final String message;

    public CrmOrderStatus getByCode(Integer code) {
        for (CrmOrderStatus value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }
}
